import { Status, RoomStatus, GameMode, Difficulty } from './../types/graphql'
import Vue from 'vue'

const playerStatusMap: Record<Status, string> = {
  GAMING: '游戏中',
  OFFLINE: '离线',
  READY: '已准备',
  WAITING: '等待中',
  WANDERING: '待机'
}

const roomStatusMap: Record<RoomStatus, string> = {
  GAMING: '游戏中',
  WAITING: '未开始'
}

const gameModeMap: Record<GameMode, string> = {
  COOR: '合作',
  VERSUS: '对战'
}

const difficultyModeMap: Record<Difficulty, string> = {
  EASY: '简单',
  HARD: '困难',
  MEDIUM: '普通',
  VERY_HARD: '专家'
}

Vue.filter('playerStatusToStr', function(status: Status) {
  return playerStatusMap[status]
})

Vue.filter('roomStatusToStr', function(status: RoomStatus) {
  return roomStatusMap[status]
})

Vue.filter('gameModeToStr', function(mode: GameMode) {
  return gameModeMap[mode]
})

Vue.filter('difficultyToStr', function(difficulty: Difficulty) {
  return difficultyModeMap[difficulty]
})
